package com.xuecheng.media.controller;

import com.xuecheng.api.media.MediaOperationApi;
import com.xuecheng.api.media.qo.QueryMedia;
import com.xuecheng.api.media.vo.MediaAuditVo;
import com.xuecheng.common.domain.page.PageRequestParams;
import com.xuecheng.common.domain.page.PageVO;
import com.xuecheng.media.service.MediaService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <h4>xuecheng</h4>
 * <p>媒资运营商</p>
 *
 * @author : by wujianming
 * @date : 2021-12-15 17:38
 **/
@RestController
@Slf4j
public class MediaOperationController implements MediaOperationApi {

    @Autowired
    private MediaService mediaService;
    //获取媒资信息列表
    @Override
    @PostMapping("/m/media/list")
    public PageVO queryMediaList(PageRequestParams page, @RequestBody QueryMedia media) {
//        return null;
//        Long companyId = SecurityUtil.getCompanyId();
        return mediaService.queryMediaAuditList(page, media);
    }

    //运营商课程审核
    @Override
    @PutMapping("m/media/audit")
    public void mediaAudit(@RequestBody MediaAuditVo mediaAuditVo) {
        mediaService.MediaAudit(mediaAuditVo);
    }

    @Override
    @GetMapping("m/media/preview/{mediaId}")
    public String mediaPreview(@PathVariable Long mediaId) {
        return mediaService.mediaPreview(mediaId);
    }
}
